﻿namespace Home
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Linq.Expressions;
    using System.Text;
    using System.Threading.Tasks;

    public static class TypeHelper
    {
        public static T Create<T>()
        {
            return (T)Create(typeof(T));
        }

        public static object Create(Type type)
        {
            Debug.Assert(type != null);

            return Expression.Lambda<Func<object>>(Expression.New(type), new ParameterExpression[0]).Compile()();
        }
    }
}
